<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>同步和异步</title>
</head>
<body>
    <p>js执行机制是单线程</p>

<script>
    console.log('1');
    console.log('2');
    setTimeout(function (){console.log('3')},3000);
    console.log('4')
    //控制台输出顺序 1,2,4,3
</script>
</body>
</html>